package com.lifp.controller;

import com.lifp.socketServer.WebSocketFanoutServer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author lifp
 * @date 2023/10/09
 */
@RestController
@RequestMapping("fanout")
public class FanoutMessageTestController {
    @Resource
    private WebSocketFanoutServer fanoutServer;

    /**
     * 模拟服务端消息推送
     * @param msg
     * @return void
     * @author lifp
     * @date 2023/10/9
     **/
    @GetMapping("/send/{msg}")
    public void sendMessage(@PathVariable String msg){
        fanoutServer.fanoutMessage(msg);
    }
}
